package cn.demo.pm.domain;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.mybatisflex.annotation.Table;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.core.constant.SqlOperator;
import com.mybatisflex.core.query.SqlOperators;
import cn.demo.common.mybatisFlex.MyInsertListener;
import cn.demo.common.mybatisFlex.MyUpdateListener;
import cn.demo.common.annotation.Excel;
import io.swagger.v3.oas.annotations.media.Schema;
import com.fasterxml.jackson.annotation.JsonIgnore;
import cn.demo.common.core.domain.BaseEntity;
/**
 * 积分商城产品对象 pm_store_goods
 *
 * @author xtjun
 * @date 2024-06-03
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Table(value = "pm_store_goods",onInsert = MyInsertListener.class,onUpdate = MyUpdateListener.class)
public class PmStoreGoods extends BaseEntity {
    private static final long serialVersionUID = 1L;

    @Id
    @Schema(description = "id")
    private String id;

    @Excel(name = "商品名")
    @Schema(description = "商品名")
    private String goodsName;

    @Excel(name = "商品内容")
    @Schema(description = "商品内容")
    private String goodsContent;

    @Excel(name = "计量单位")
    @Schema(description = "计量单位")
    private String goodsUnit;

    @Excel(name = "商品图片")
    @Schema(description = "商品图片")
    private String goodsPic;

    @Excel(name = "所需积分")
    @Schema(description = "所需积分")
    private Long integral;

    @Excel(name = "库存数量")
    @Schema(description = "库存数量")
    private Long quantity;

    @Excel(name = "是否推荐", dictType = "sys_yes_no")
    @Schema(description = "是否推荐(字典:sys_yes_no)")
    private Integer isRecommend;

    @Excel(name = "是否上架", dictType = "sys_yes_no")
    @Schema(description = "是否上架(字典:sys_yes_no)")
    private Integer isEnable;

    @Excel(name = "部门id")
    @Schema(description = "部门id")
    private String deptId;

    // 自定义字段的 SQL 操作符
    @JsonIgnore
    public static final SqlOperators operators = new SqlOperators() {{
        set(PmStoreGoods::getGoodsName, SqlOperator.LIKE);
        set(PmStoreGoods::getGoodsUnit, SqlOperator.EQUALS);
        set(PmStoreGoods::getIntegral, SqlOperator.EQUALS);
        set(PmStoreGoods::getQuantity, SqlOperator.EQUALS);
        set(PmStoreGoods::getIsRecommend, SqlOperator.EQUALS);
        set(PmStoreGoods::getIsEnable, SqlOperator.EQUALS);
        set(PmStoreGoods::getDeptId, SqlOperator.EQUALS);
    }};
}
